package com.status200.controller;

import com.status200.model.Tutor;
import com.status200.service.TeacherService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *
 * @author status200
 * @date 2017/12/17
 */
@RestController
public class TeacherController {

    private final TeacherService teacherService;

    public TeacherController(TeacherService teacherService) {
        this.teacherService = teacherService;
    }

    @GetMapping("api/manage-teacher/all-teacher")
    public List<Tutor> getAllTutor() {
        return teacherService.getAllTutor();
    }

    @PostMapping("api/manage-teacher/update-teacher")
    public void updateTutor(@RequestBody Tutor tutor) {
        teacherService.updateTutor(tutor);
    }

    @PostMapping("api/manage-teacher/delete-teacher")
    public void deleteTutor(@RequestBody Tutor tutor) {
        teacherService.deleteTutor(tutor);
    }

    @PostMapping("api/manage-teacher/add-teacher")
    public void addTutor(@RequestBody Tutor tutor) {
        teacherService.addTutor(tutor);
    }
}
